<template>
	<view class="container">
		<view class="kuang">
			<image class="bj" src="/static/图层 1@3x.png" mode=""></image>
			<view class="nav-bar">
				<view class="nav-left" @click="goBack">
					<uni-icons type="left" size="20" color="#ffffff"></uni-icons>
				</view>
				<text class="title">核销记录</text>
				<view class="nav-right">
					<view>
						<uni-icons type="more-filled" size="22" color="#ffffff"></uni-icons>
					</view>
					<text class="nav-separator">|</text>
					<view>
						<uni-icons type="location-filled" size="22" color="#ffffff"></uni-icons>
					</view>
				</view>
			</view>
			<!-- 搜索栏 -->
			<view class="search-section">
				<view class="search-bar">
					<input class="search-input" v-model="searchKeyword" placeholder="输入需要搜索的内容" placeholder-style="color: #999;" />
					<view class="search-icon" @click="handleSearch">
						<uni-icons type="search" size="20" color="#007AFF"></uni-icons>
					</view>
				</view>
			</view>
		</view>

		<!-- 记录列表容器 -->
		<view class="record-container">
			<view class="record-list">
				<view class="record-item" v-for="(item, index) in recordList" :key="index" @click="viewDetail(item)">
					<view class="service-desc">{{ item.serviceDesc }}</view>
					<view class="record-info">
						<text class="info-label">下单用户:</text>
						<text class="info-value">{{ item.userName }}</text>
					</view>
					<view class="record-info">
						<text class="info-label">实付金额:</text>
						<text class="info-value amount">¥{{ item.amount }}</text>
					</view>
					<view class="record-info">
						<text class="info-label">核销时间:</text>
						<text class="info-value time">{{ item.verifyTime }}</text>
					</view>
				</view>
			</view>
		</view>

		<!-- 空状态 -->
		<view class="empty-state" v-if="recordList.length === 0">
			<text>暂无核销记录</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchKeyword: '',
				recordList: [
					{
						serviceDesc: '普通洗车、机油、工时',
						userName: '张三',
						amount: '32.00',
						verifyTime: '2022-10-12 11:09'
					},
					{
						serviceDesc: '普通洗车、机油、工时',
						userName: '张三',
						amount: '32.00',
						verifyTime: '2022-10-12 11:09'
					},
					{
						serviceDesc: '普通洗车、机油、工时',
						userName: '张三',
						amount: '32.00',
						verifyTime: '2022-10-12 11:09'
					}
				]
			}
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},
			handleSearch() {
				// 搜索逻辑
				uni.showToast({
					title: '搜索功能',
					icon: 'none'
				})
			},
			viewDetail(item) {
				// 查看详情
				uni.showToast({
					title: '查看详情',
					icon: 'none'
				})
			}
		}
	}
</script>

<style scoped>
	.container {
		min-height: 100vh;
		width: 100%;
		position: relative;
		background-color: #f5f5f5;
	}

	.bj {
		position: absolute;
		z-index: 1;
		width: 750rpx;
		height: 430rpx;
		left: 0;
		top: 0;
	}

	.kuang {
		display: flex;
		flex-direction: column;
		position: relative;
		width: 100%;
		height: 430rpx;
	}

	.nav-bar {
		position: relative;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 30rpx;
		margin-top: 60rpx;
		height: 88rpx;
		box-sizing: border-box;
	}

	.nav-left {
		width: 40rpx;
		height: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: white;
		font-weight: bold;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}

	.nav-right {
		display: flex;
		align-items: center;
	}

	.nav-right > view {
		margin-right: 10rpx;
	}

	.nav-right > view:last-child {
		margin-right: 0;
	}

	.nav-separator {
		color: rgba(255, 255, 255, 0.5);
		font-size: 20rpx;
		margin: 0 8rpx;
	}

	/* 搜索区域 */
	.search-section {
		position: relative;
		z-index: 2;
		padding: 20rpx 30rpx;
		margin-top: 20rpx;
	}

	.search-bar {
		display: flex;
		align-items: center;
		background-color: #ffffff;
		border-radius: 50rpx;
		padding: 20rpx 24rpx;
		overflow: hidden;
	}

	.search-input {
		flex: 1;
		font-size: 28rpx;
		color: #333;
		background-color: transparent;
	}

	.search-icon {
		margin-left: 15rpx;
		padding: 5rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.record-container {
		position: absolute;
		z-index: 2;
		top: 300rpx;
		left: 20rpx;
		right: 20rpx;
		background-color: white;
		border-radius: 30rpx 30rpx 0 0;
		padding: 20rpx 30rpx;
		padding-bottom: 20rpx;
		box-sizing: border-box;
		min-height: 200rpx;
	}

	.record-list {
		width: 100%;
	}

	.record-item {
		background-color: #ffffff;
		border-radius: 8rpx;
		padding: 30rpx;
		margin-bottom: 20rpx;
		box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
		border: 1rpx solid #f0f0f0;
	}

	.record-item:last-child {
		margin-bottom: 0;
	}

	.service-desc {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		margin-bottom: 20rpx;
	}

	.record-info {
		display: flex;
		align-items: center;
		margin-bottom: 12rpx;
		font-size: 28rpx;
	}

	.record-info:last-child {
		margin-bottom: 0;
	}

	.info-label {
		color: #666;
		margin-right: 10rpx;
	}

	.info-value {
		color: #333;
	}

	.info-value.amount {
		color: #333;
		font-weight: normal;
	}

	.info-value.time {
		color: #999;
		font-size: 24rpx;
	}

	.empty-state {
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 100rpx 0;
		font-size: 28rpx;
		color: #999;
	}

</style>